import MySQLdb
import re

db = MySQLdb.connect(host="localhost", user="jimmy", passwd="Ahbh37-4ta", db="twitter")

cur = db.cursor() 

fd = open("twitter_rv.net", "r")

line = fd.readline().strip()

r = re.compile('\s+')

while line:
	#try:
		id, fid = r.split(line)
		cur.execute("""INSERT INTO user_id_follower_id (user_id, follower_id) VALUES (%s,%s)""", (id, fid))
		#db.commit()
		line = fd.readline().strip()
	#except:     
	#	db.rollback()

fd.close()
cur.close()
db.close()
